﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;

namespace DAO
{
    public class ChucVuDAO
    {
        DataProvider dp = new DataProvider();
        //Load danh sach
        public DataTable LoadDSChucVu()
        {
            return dp.SqlExcuteQuery("sp_LoadDSChucVu");
        }

        //Them mot chuc vu
        public void ThemChucVu(ChucVuDTO cvDTO)
        {
            SqlParameter[] pram = { new SqlParameter("@MaChucVu", cvDTO.MaChucVu), new SqlParameter("@TenChucVu", cvDTO.TenChucVu) };
            dp.SqlExcuteNonQuery("sp_ThemChucVu", pram);
        }

        //Xoa mot chuc vu
        public void XoaChucVu(string macv)
        {
            SqlParameter pram = new SqlParameter("@MaChucVu",macv);
            dp.SqlExcuteNonQuery("sp_XoaChucVu",pram);
        }

        public void SuaChucVu(ChucVuDTO cvDTO)
        {
            SqlParameter[] pram = { new SqlParameter("@MaChucVu", cvDTO.MaChucVu), new SqlParameter("@TenChucVu", cvDTO.TenChucVu) };
            dp.SqlExcuteNonQuery("sp_SuaChucVu", pram);
        }

        public DataTable SapXepZA()
        {
            return dp.SqlExcuteQuery("sp_SapXepZA");
        }
    }
}
